package com.fxp.project.jiuselu.web.business.v1.controller.userlog;

import java.util.List;

import com.fxp.project.jiuselu.web.base.controller.BaseController;
import com.fxp.project.jiuselu.web.domain.CommonResult;
import com.fxp.project.jiuselu.web.models.userlog.entity.UserLogBrowse;
import com.fxp.project.jiuselu.web.models.userlog.service.IUserLogBrowseService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * 浏览足迹Controller
 *
 * @author Jason.Wang
 * @date 2022-08-12
 */
@RestController
@RequestMapping("v1/user/browse")
public class UserLogBrowseController extends BaseController
{
    @Autowired
    private IUserLogBrowseService userLogBrowseService;


    /**
     * 新增浏览足迹
     */
    @PostMapping
    @CrossOrigin
    public CommonResult add(@RequestBody UserLogBrowse userLogBrowse)
    {
        int i = userLogBrowseService.insertUserLogBrowse(userLogBrowse);
        if (i==0){
            return  CommonResult.failed("该商品已浏览");
        }
        return CommonResult.success(i);
    }

}
